package com.jy.adscm.operation.hscrb.service.impl;

import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.jy.adscm.bean.system.JyUser;
import com.jy.adscm.operation.hscrb.bean.SjInspection;
import com.jy.adscm.operation.hscrb.bean.SjInspectioninfo;
import com.jy.adscm.operation.hscrb.mapper.mysql.SjInspectioninfoMapper;
import com.jy.adscm.operation.hscrb.service.SjInspectioninfoService;
import com.jy.adscm.system.mapper.mysql.JyUserMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author zyl
 * @since 2018-12-14
 */
@Service
public class SjInspectioninfoServiceImpl extends ServiceImpl<SjInspectioninfoMapper, SjInspectioninfo> implements SjInspectioninfoService {
  @Autowired
    JyUserMapper jyUserMapper;
    @Override
    public List<SjInspectioninfo> selectByTid(String tid) {
        Wrapper<SjInspectioninfo> wrapper =new EntityWrapper<>();
        wrapper.eq("TID",tid);
        List<SjInspectioninfo> sjInspectioninfos = super.selectList(wrapper);
        for (SjInspectioninfo SjInspectioninfo : sjInspectioninfos) {
            if (SjInspectioninfo.getPerson()!=null && !"".equals(SjInspectioninfo.getPerson())){
                JyUser jyUser = jyUserMapper.selectById(SjInspectioninfo.getPerson());
                SjInspectioninfo.setPersonName(jyUser.getName());
            }
        }
        return sjInspectioninfos;
    }
}
